<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.7.10/dist/vue.js"></script>
</head>
<body>
    <div id="app">
        <!-- 一旦在给事件绑定事件函数的时候,添加了括号,事件函数不会直接调用,还是等事件触发的时候才调用 -->
        <!-- 在v-on绑定事件的插值语法中，默认是存在一个$event的值，代表当前的event事件对象 -->
        <button @click="fn1($event)">点击1</button>
        <!-- 传递多个参数时的情况 -->
        <button @click="fn2($event,2)">点击2</button>
    </div>
    <script>
        const vm = new Vue({
            el: "#app",
            data() {
                return {
                };
            },
            methods: {
                fn1(event) {
                    console.log(event);
                },
                fn2(event, a) {
                    console.log(event, "fn2");
                }
            },
        });
    </script>
</body>

</html>